import "./style.css"; //导入全局样式
import "@fortawesome/fontawesome-free/css/all.min.css";
import { createApp } from "vue";
import { createPinia } from "pinia"; //直接在main。js终生使用
import { VueMasonryPlugin } from "vue-masonry";
import "vant/lib/index.css"; //导入UI库
import router from "./router"; //路由
import App from "./App.vue";
import { isLogined } from "./utils/tools";
//创建一个store，名字随便起,.user(store)使用
const store = createPinia();
router.beforeEach((to, from, next) => {
  if (to.meta.needlogin) {
    if (isLogined()) {
      next();
    } else {
      next({
        name: "Login",
      });
    }
  } else {
    next();
  }
});
createApp(App).use(VueMasonryPlugin).use(store).use(router).mount("#app");
